CX_SPAN_DATE
Class hierarchy
Description:
This class consists of a date(CX_DATE) and a duration in a time unit (Duration, CX_VALUE).
It can be interpreted in different ways: The date represents the start and the date extended by the duration (start+duration) represents the end. If it is interpreted as an operation, it starts on the date and its effort is stored in the duration. This effort can be 0 or even negative.
For these two meanings there are flags in the value validEnum which cover certain special cases: On the one hand it can be determined that the interval is unlimited (infinite) or semi-unlimited (no start or end). On the other hand, the duration can extend only over certain days like working days(net) instead of all days (gross).
These modes are mutually exclusive: If the date period is (semi-)unlimited, the duration has no meaning. (Theoretical duration: infinite.) If the duration is net, the date period must be limited.
The duration does not have to be given in days. It can also be given in weeks, months, years and so on.
If the date falls at the beginning of such a period, it is called a diffuse date period. In this case the date period stands for a certain number of periods in the coarser unit.
Again, there is a limitation compared to the modes: Diffuse date periods are always restricted and gross.
For certain arithmetic operations, such as setting the start date, it may be necessary to calculate the duration back to individual days.
The date is initialised with the current date, as is any date. The duration is set to 1 day by default. The default mode is gross and restricted(FROM_TO).
In a sense, any simple date can also be understood as a date period: Many functions that were actually designed for a date period can also be applied to a date. If a duration of one day is assumed.
While a date can be incomplete, a date period must have at least one year. It is therefore not possible to define periods such as "April - May" or "1 - 15".
Code example:
1 "On 10.1.1996"
2) "From 10.1.1996 to 12.1.1996
3rd "The second quarter of 1994".
4 "From the 14th to the 17th calendar week 1996 inclusive".
5) "From 20.5.1996"
Display on screen:
The following options exist for displaying objects of this class:
1. use of a surface object of type String.
In this case, the object is specified in a single input field. In addition to entries of the type "Start date - End date", entries such as "2nd quarter 1996" are also possible. Also entries like "4KW96-7KW96" (= "from the beginning of the 4th calendar week to the end of the 7th calendar week 1996") are supported. The following table shows all possible representations. Please note that the year can be entered in two digits, in which case the currently set base century is added. The unit of measurement, e.g. "Mt" for month, depends on the system units set. For example, in German you can also write "Monat" instead of "Mt". Spaces and full stops are optional, so that "2nd quarter 1996" can also be written as "2Quarter1996" or "2Q96".
Input | Date |
---|---|
Start - End | From the start date to the end date |
n Kw Year | The n. calendar week in the year Year |
n Mt year | The n. month in the year Year |
n Q Year | The n. quarter in the year year |
n T Year | The n. Tertial in the year Year |
Year | The year Year |
n Jz m | The n. decade in the m. century |
n century | The n. Century |
n yt | The n. Millennium |
Note: When entering a date period, the start and end dates are separated by one of the following characters: '-', '-' or '/'.
The following figures show examples (programme code):
2. the use of two interface objects of type Date
The start date is entered in one field and the end date in the other (programme code). Please note that only defined start and end dates can be managed without additional surface objects, i.e. specifications such as "from 3.10.1990" are not possible.
3. the use of the interface objects Date and String
The first surface object indicates the start date and the second the duration (programme code). Please note that without additional surface objects only defined start and end dates can be managed, i.e. specifications such as "from 3.10.1990" are not possible.
In connection with these display options and certain InstantView instructions, the flags belonging to the object play an important role, as they can be used to modify the display of the object.
Function | MA* | Parameters | Return | Brief description |
---|---|---|---|---|
Detailed information: | ||||
ValueOfDate | INTEGER | internal date value | ||
Duration | OBJECT | Period duration | ||
Daily information: | ||||
DayOfDate | INTEGER | Day of the date | ||
WeekOfDate | INTEGER | Calendar week of the date | ||
MonthOfDate | INTEGER | Month of the date | ||
QuarterOfDate | INTEGER | Quarter of the date | ||
TertianOfDate | INTEGER | Tertial of the date | ||
YearOfDate | INTEGER | Year of date | ||
DecadeOfDate | INTEGER | Decade of the date | ||
CenturyOfDate | INTEGER | Century of the date | ||
MillenniumOfDate | INTEGER | Millennium of the date | ||
Weekly data: | ||||
DayOfWeek | INTEGER | Weekday of the date | ||
DayInWeek | INTEGER | Weekday position regarding the start of the working week | ||
YearOfWeek | INTEGER | Year of calendar week | ||
Monthly data: | ||||
DaysInMonth | INTEGER | Number of days per month | ||
Annual data: | ||||
DayOfYear | INTEGER | Day position in the year | ||
Monolingual: | ||||
WeekdayNameOfDay | STRING | Name of the weekday | ||
ShortWeekdayNameOfDay | STRING | abbreviated weekday name | ||
Name Of Month | STRING | Name of the month | ||
ShortNameOfMonth | STRING | abbreviated name of the month | ||
NameOfDay | STRING | (Holiday) name of the day | ||
SpecialNameOfDay | INTEGER | STRING | specific (holiday) name of the day | |
Multilingual: | ||||
MLWeekdayNameOfDay | MLSTRING | multilingual weekday name | ||
MLShortWeekdayNameOfDay | MLSTRING | multilingual abbreviated weekday name | ||
MLNameOfMonth | MLSTRING | multilingual name of the month | ||
MLShortNameOfMonth | MLSTRING | multilingual abbreviated name of the month | ||
MLNameOfDay | MLSTRING | multilingual (holiday) name of the day | ||
MLSpecialNameOfDay | INTEGER | MLSTRING | specific multilingual (holiday) name of the day | |
conversions: | ||||
ImportDateNumber | STRING, INTEGER | Import of the date number as string | ||
ExportDateNumber | INTEGER, INTEGER | STRING | Export of the date number as string | |
ImportObject | OBJECT | Set (start) date | ||
SetDate | STRING, INTEGER | Import base date from the passed string | ||
SetSpanDate 231532 | STRING, INTEGER | Import date period from the passed string. | ||
Day type specifications: | ||||
IsDateType | INTEGER | INTEGER | Is the date a "special day off"? | |
IsTerm | INTEGER | Is the date an appointment? | ||
IsAnniversary | INTEGER | Is the date an anniversary? | ||
IsHoliday | INTEGER | Is the date a public holiday? | ||
IsVacation | INTEGER | Is the date a holiday? | ||
IsWorkingday | INTEGER | Is the date a working day? | ||
TypeOfDate | INTEGER | Type of date | ||
LeapYear | INTEGER | Is the date a leap year? | ||
IsDiffuse | INTEGER | Is the duration not given in days? | ||
Date comparisons: | ||||
Encompassed | OBJECT | INTEGER | "Contained in" test (conjunction) | |
Overlap | OBJECT | INTEGER | Overlap test (disjunction) | |
AgeInYMD | OBJECT | VECTOR<object></ob | Exact difference to another date | |
AgeInFullYears | OBJECT | OBJECT | Rounded annual difference to another date | |
AgeInCommencedYears | OBJECT | OBJECT | Annual difference rounded up to another date | |
Relative data: | ||||
First | INTEGER | OBJECT | first day of the week in the month | |
Second | INTEGER | OBJECT | second weekday of the month | |
Third | INTEGER | OBJECT | third weekday of the month | |
Fourth | INTEGER | OBJECT | fourth day of the week in the month | |
Load | INTEGER | OBJECT | last day of the week in the month | |
Previous | INTEGER | OBJECT | Search for a previous specific weekday | |
Next | INTEGER | OBJECT | Search for a next specific day of the week | |
NextDate | OBJECT | OBJECT | the following day within the date period | |
NextTerm | OBJECT | OBJECT | the following day within the date period (as DateTime) | |
Easter | OBJECT | Easter Sunday calculation | ||
Create its object: | ||||
Day | INTEGER, INTEGER | OBJECT | Create a date in the current year | |
Date | INTEGER, INTEGER, INTEGER | OBJECT | Generate an exact date of the day | |
SpanDate | OBJECT, OBJECT | OBJECT | Generating an exact date period | |
Week | OBJECT | Creating a calendar week | ||
Month | Create a month | |||
Quarter | Create a quarter | |||
Tertian | Creating a tertial | |||
Year | Creating a year | |||
Decade | Creating a decade | |||
Century | Creating a century | |||
Millennium | Creating a millennium | |||
Detailed information: | ||||
SetDay | INTEGER | Setting a new day | ||
SetMonth | INTEGER | Setting a new month | ||
SetYear | INTEGER | Setting a new year | ||
SetZero | Set to "unlimited | |||
Start/end: | ||||
StartOfPeriod | OBJECT | Start of period | ||
EndOfPeriod | OBJECT | End of period | ||
StartOfPeriodMA | * | Start of period | ||
EndOfPeriodMA | * | End of period | ||
RealStartOfPeriod | OBJECT | The earlier of the border periods | ||
RealEndOfPeriod | OBJECT | The later of the border periods | ||
FirstPeriod | OBJECT | First partial period | ||
LastPeriod | OBJECT | Last partial period | ||
SetStartOfPeriod | OBJECT | Setting a start date with changing the period duration | ||
SetEndOfPeriod | OBJECT | Setting the end date with changing the period duration | ||
MoveStartOfPeriod (MovePeriodToStartDate) | OBJECT | Setting the start date without changing the period duration | ||
MoveEndOfPeriod (MovePeriodToEndDate) | OBJECT | Setting the end date without changing the period duration | ||
SetRealStartOfPeriod | OBJECT | Setting the earlier date with changing the period duration | ||
SetRealEndOfPeriod | OBJECT | Setting the later date with changing the period duration | ||
MoveRealStartOfPeriod | OBJECT | Setting the earlier date without changing the period duration | ||
MoveRealEndOfPeriod | OBJECT | Setting the later date without changing the period duration | ||
SetPeriodBorders | OBJECT, OBJECT | Setting the start and end date | ||
addition/subtraction: | ||||
AddDay | INTEGER | Daily Addition | ||
AddNetDay | INTEGER, INTEGER | Adds so many days that the date is moved by the specified number of days in the given day category | ||
AddWeek | INTEGER | Weekly addition | ||
AddMonth | INTEGER | Monthly addition | ||
AddYear | INTEGER | Annual addition | ||
Set operations: | ||||
JoinPeriods | OBJECT | OBJECT | Create a union (conjunction) from two date periods | |
OverlappingPeriod | OBJECT | Generate the intersection (disjunction) from two date periods | ||
Duration/net/gross: | ||||
Duration | OBJECT | Period duration (depending on day category) | ||
SetDuration | OBJECT | Set the period duration (becomes gross) | ||
NetDuration | INTEGER | OBJECT | Net period duration (for each day category) | |
SetNetDuration | OBJECT, INTEGER | Setting the period duration for day category | ||
GrossDuration | OBJECT | Gross period duration (independent of day category) | ||
SetGrossDuration | OBJECT | Setting the period duration without day category | ||
RealDuration | OBJECT | Period duration (positive even if StartOfPeriod later than EndOfPeriod) | ||
SetRealDuration | OBJECT | Setting the period duration while retaining the sign | ||
DurationMA | * | Period duration | ||
GrossDurationMA | * | Gross period duration (independent of day category) | ||
RealDurationMA | * | Period duration (positive even if StartOfPeriod later than EndPeriod) | ||
IsNet | INTEGER | INTEGER | Is the daily category (net type) set? | |
GetNet | INTEGER | Day categories (bit field) | ||
SetNet | INTEGER | set the day category | ||
string | INTEGER | CX_STRING | Returns the string representation of the object |
* MA = Member Access Function
Data field | Type | Reference class | I* | Brief description |
---|---|---|---|---|
this | CX_SPAN_DATE | |||
duration | CX_VALUE | The period length. Can be any unit traceable to day, it does not have to be positive. Which days it includes depends on the net type. (see also function Duration) | ||
validEnum | INTEGER | Bit 0-1: The type of time period: "0" = a time period with start and end (FROM_TO) "1" = start, but there is no end (FROM) "2" = end, but there is no start (TO) "3" = infinite period without start and end (ENDLESS) Bit 2-7: Daily categories to which the duration refers. Set bit means: the respective category is removed from the duration. If none of these bits is set (default) this means that the duration is gross, i.e. it includes all days between start and end. All bits set does not occur, as this would mean that no day is counted with the duration. The bits (categories) in detail (see also date type constants):
|
* I = Indexable data field
Module | Brief description |
---|---|